<?php
namespace jzq\test;
require_once __DIR__ . '/../vendor/autoload.php';

function getBytes($string) {
    $bytes = array();
    for($i = 0; $i < strlen($string); $i++){
        $bytes[] = ord($string[$i]);
    }
    return $bytes;
}
function base64url_encode($data) {
    return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
//raw_output 行输出，后面再使用base64就会很小
$sha256=hash ( 'sha256', "123456",true );
echo $sha256."\r\n";
$base64=base64url_encode($sha256);
echo $base64;